package com.realgodo.site.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.orm.Page;

import com.realgodo.site.entity.application.show.Show;
import com.realgodo.site.entity.application.show.ShowCatalog;
import com.realgodo.site.service.application.ShowCatalogManager;
import com.realgodo.site.service.application.ShowManager;

public class ViedoController extends ControllerSupport{

	/***/
	private static final long serialVersionUID = 5395595611810248727L;
	@Autowired
	private ShowManager showManager;
	@Autowired
	private ShowCatalogManager showCatalogManager;

	private Long sId;
	private Page<Show> showPage = new Page<Show>(20);

	public String index() throws Exception {
		Show showForm = new Show();
		if(null!=getsId()){
			showForm.setSid(getsId());
		}
		showForm.setViedo(Show.VIEDO_YES);
		showForm.setTop(Show.TOP_YES);
		showForm.setPrivacy(Show.PRIVACY_PUBLIC);
		showPage = this.showManager.findShows(showPage, showForm);
		return "viedo";
	}

	public Page<Show> getShowPage() {
		return showPage;
	}

	public void setShowPage(Page<Show> showPage) {
		this.showPage = showPage;
	}

	public List<ShowCatalog> getShowCatalogs() {
		Page<ShowCatalog> showCatalogPage = new Page<ShowCatalog>(15);
		return this.showCatalogManager.findShowCatalogs(showCatalogPage)
				.getResult();
	}

	public Long getsId() {
		return sId;
	}

	public void setsId(Long sId) {
		this.sId = sId;
	}


}
